package com.tddx.activiti.business.sys.service.systuser;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.tddx.activiti.base.BaseService;
import com.tddx.activiti.business.sys.dao.systuser.SysTuserDao;
import com.tddx.activiti.business.sys.dao.systuser.SysTuserJdbc;
import com.tddx.activiti.business.sys.entity.systuser.SysTuserEntity;

/**
 * service layer 服务层 
 * @Auth yanweizhao 
*/
@Service
public class SysTuserService extends BaseService<SysTuserEntity, String>{

	@Autowired private SysTuserDao dao;
	@Autowired private SysTuserJdbc jdbc;
	
	public SysTuserEntity findOne(Long id){
		SysTuserEntity entity = dao.findOne(id);
		return entity;
	}
	
	public SysTuserEntity findByVcUsername(String vcUserName){
		SysTuserEntity entity = dao.findByVcUsername(vcUserName);
		return entity;
	}
	
	public SysTuserEntity save(SysTuserEntity entity){
		entity = dao.saveAndFlush(entity);
		return entity;
	}
	
	public void delete(String ids){
		for(String idStr: ids.split(",")){
			Long id = Long.valueOf(idStr);
			SysTuserEntity entity = dao.findOne(id);
			entity.setVcDel("1");
		}
	}
	
	public Object findList(){
		Object obj = jdbc.findListByCondition();
		return obj;
	}
	
}
